package br.com.mtg.movethegarbage.impl;

import br.com.mtg.movethegarbage.framework.Graphics;
import br.com.mtg.movethegarbage.graphics.SpriteManager;

public class ArrowButton extends Button
{
	public static final int DIRECTION_RIGHT = 0;
	public static final int DIRECTION_LEFT = 1;
	public static final int DIRECTION_UP = 2;
	public static final int DIRECTION_DOWN = 3;
	int direction;

	public ArrowButton(float _x, float _y, float _w, float _h, int _direction)
	{
		super(_x, _y, _w, _h);
		direction = _direction;
	}

	@Override
	public void draw(Graphics graphics)
	{
		if (w == 0 && h == 0)
			return;
		SpriteManager spriteManager = new SpriteManager(graphics, 1);
		spriteManager.beginDraw(buttonSprite.texture);
		float angle = 0;
		switch (direction)
		{
			case DIRECTION_RIGHT:
				angle = -90.0F;
				break;
			case DIRECTION_LEFT:
				angle = 90.0F;
				break;
			case DIRECTION_UP:
				angle = 0.0F;
				break;
			case DIRECTION_DOWN:
				angle = 180.0F;
				break;
		}
		spriteManager.drawSprite(x + w / 2, y + h / 2, w, h, angle, buttonSprite);
		spriteManager.endDraw();
	}
}